package com.yunhe.authority;

import com.yunhe.common.filter.ServerContextFilter;
import com.yunhe.common.interceptor.ServerContextInterceptor;
import feign.RequestInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@EnableFeignClients(basePackages = {"com.yunhe"})
@ComponentScan(basePackages = {"com.yunhe"})
public class AuthorityServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(AuthorityServerApplication.class, args);
    }

    /**注册  Feign拦截器*/
    @Bean
    public RequestInterceptor serverContextInterceptor(){
        return new ServerContextInterceptor();
    }

    /**注册过滤器*/
    @Bean
    public ServerContextFilter serverContextFilter() {
        return new ServerContextFilter();
    }
}
